package mf.tools;

/** Tuple object with values of type K. */
public class Tuple<K> {
	
	//values
	private K lft;
	private K rght;
	
	/** Creates a new tuple (l, r). */
	public Tuple(K l, K r) {
		set(l, r);
	}
	
	/** Creates an empty tuple. */
	public Tuple() {
		set(null, null);
	}
	
	/** Get the left part. */
	public K left() {
		return lft;
	}
	
	/** Sets the value of the left part to l. */
	public void left(K l) {
		lft = l;
	}
	
	/** Get the right part. */
	public K right() {
		return rght;
	}
	
	/** Sets the value of the right part to r. */
	public void right(K r) {
		rght = r;
	}
	
	/** Sets the value of the tuple to (l, r). */
	public void set(K l, K r) {
		left(l);
		right(r);
	}
	
	/** Returns a string representation. */
	public String toString() {
		return "(" + lft.toString() + ", " + rght.toString() + ")";
	}
}
